{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {
    "colab": {
     "autoexec": {
      "startup": false,
      "wait_interval": 0
     }
    },
    "colab_type": "code",
    "id": "IWTXM4EVJ0Vp",
    "scrolled": true
   },
   "outputs": [],
   "source": [
    "import numpy as np\n",
    "import pandas as pd\n",
    "import pickle\n",
    "from collections import defaultdict\n",
    "import re\n",
    "from bs4 import BeautifulSoup\n",
    "import sys\n",
    "import os\n",
    "os.environ['KERAS_BACKEND']='theano'\n",
    "from keras.preprocessing.text import Tokenizer\n",
    "from keras.preprocessing.sequence import pad_sequences\n",
    "from keras.utils.np_utils import to_categorical\n",
    "from keras.layers import Embedding\n",
    "from keras.layers import Dense, Input, Flatten\n",
    "from keras.layers import Conv1D, MaxPooling1D, Embedding, Dropout, LSTM, GRU, Bidirectional\n",
    "from keras.models import Model\n",
    "from keras.callbacks import ModelCheckpoint\n",
    "import matplotlib.pyplot as plt\n",
    "plt.switch_backend('agg')\n",
    "from keras import backend as K\n",
    "from keras.engine.topology import Layer, InputSpec\n",
    "from keras import initializers\n",
    "%matplotlib inline\n",
    "\n",
    "import tensorflow as tf"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "train len 2064\n",
      "test len 688\n",
      "word2id len 561\n"
     ]
    }
   ],
   "source": [
    "fname_train = '../data/train.pkl'\n",
    "fname_test = '../data/test.pkl'\n",
    "\n",
    "with open(fname_train, 'rb') as inp:\n",
    "    word2id = pickle.load(inp)\n",
    "    id2word = pickle.load(inp)\n",
    "    relation2id = pickle.load(inp)\n",
    "    entity2id = pickle.load(inp)\n",
    "    train = pickle.load(inp)\n",
    "    labels = pickle.load(inp)\n",
    "    position1 = pickle.load(inp)\n",
    "    position2 = pickle.load(inp)\n",
    "    E = pickle.load(inp)\n",
    "inp.close()\n",
    "\n",
    "with open(fname_test, 'rb') as inp:\n",
    "    test = pickle.load(inp)\n",
    "    labels_t = pickle.load(inp)\n",
    "    position1_t = pickle.load(inp)\n",
    "    position2_t = pickle.load(inp)\n",
    "    E_t = pickle.load(inp)\n",
    "inp.close()\n",
    "\n",
    "print(\"train len\", len(train))\n",
    "print(\"test len\", len(test))\n",
    "print(\"word2id len\", len(word2id))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {},
   "outputs": [],
   "source": [
    "MAX_SEQUENCE_LENGTH = 150\n",
    "EMBEDDING_SIZE = len(word2id) + 1\n",
    "EMBEDDING_DIM = 200\n",
    "\n",
    "POS_SIZE = 38*2+1 \n",
    "POS_DIM = 25\n",
    "ENTITY_DIM = 25 \n",
    "HIDDEN_DIM = 100 \n",
    "\n",
    "\n",
    "TAG_SIZE = len(relation2id)\n",
    "ENTITY_SIZE = len(entity2id)\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {},
   "outputs": [],
   "source": [
    "embedding_matrix = np.random.random((len(word2id) + 1, EMBEDDING_DIM))\n",
    "for word, i in word2id.items():\n",
    "    embedding_vector = word2id[word]\n",
    "    if embedding_vector is not None:\n",
    "        # words not found in embedding index will be all-zeros.\n",
    "        embedding_matrix[i] = embedding_vector\n",
    "\n",
    "word_embeds = Embedding(len(word2id) + 1,\n",
    "                            EMBEDDING_DIM,\n",
    "                            weights=[embedding_matrix],\n",
    "                            input_length = MAX_SEQUENCE_LENGTH,\n",
    "                            trainable=True)\n",
    "\n",
    "#pos1_embeds = Embedding(POS_SIZE,POS_DIM,input_length = MAX_SEQUENCE_LENGTH)\n",
    "#pos2_embeds = Embedding(POS_SIZE,POS_DIM,input_length = MAX_SEQUENCE_LENGTH)\n",
    "#e_embeds = Embedding(ENTITY_SIZE,ENTITY_DIM,input_length = MAX_SEQUENCE_LENGTH)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {},
   "outputs": [],
   "source": [
    "from attention import Attention"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {
    "colab": {
     "autoexec": {
      "startup": false,
      "wait_interval": 0
     },
     "base_uri": "https://localhost:8080/",
     "height": 289
    },
    "colab_type": "code",
    "executionInfo": {
     "elapsed": 11390,
     "status": "ok",
     "timestamp": 1530790300647,
     "user": {
      "displayName": "Akshat Maheshwari",
      "photoUrl": "//lh5.googleusercontent.com/-f-xJkriVoaI/AAAAAAAAAAI/AAAAAAAAAVQ/TLGa4qObGgQ/s50-c-k-no/photo.jpg",
      "userId": "114426356464940466000"
     },
     "user_tz": -330
    },
    "id": "eExWnv0ALYaG",
    "outputId": "b1c4b12e-3fbf-4c85-e67b-faab3ea88274"
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "word_embedding: (None, 150, 200)\n",
      "word_embedding: (None, 150, 256)\n",
      "word_embedding: (None, 256)\n",
      "pos1: KerasTensor(type_spec=TensorSpec(shape=(None, 64), dtype=tf.float32, name=None), name='dense/BiasAdd:0', description=\"created by layer 'dense'\")\n",
      "pos2: KerasTensor(type_spec=TensorSpec(shape=(None, 64), dtype=tf.float32, name=None), name='dense_1/BiasAdd:0', description=\"created by layer 'dense_1'\")\n",
      "e: KerasTensor(type_spec=TensorSpec(shape=(None, 128), dtype=tf.float32, name=None), name='dense_2/BiasAdd:0', description=\"created by layer 'dense_2'\")\n",
      "pos: KerasTensor(type_spec=TensorSpec(shape=(None, 128), dtype=tf.float32, name=None), name='tf.concat/concat:0', description=\"created by layer 'tf.concat'\")\n",
      "pos_e: KerasTensor(type_spec=TensorSpec(shape=(None, 256), dtype=tf.float32, name=None), name='tf.concat_1/concat:0', description=\"created by layer 'tf.concat_1'\")\n",
      "feature: KerasTensor(type_spec=TensorSpec(shape=(None, 512), dtype=tf.float32, name=None), name='tf.concat_2/concat:0', description=\"created by layer 'tf.concat_2'\")\n",
      "feature: KerasTensor(type_spec=TensorSpec(shape=(None, 64), dtype=tf.float32, name=None), name='dense_3/BiasAdd:0', description=\"created by layer 'dense_3'\")\n",
      "Bidirectional LSTM\n",
      "Model: \"model\"\n",
      "__________________________________________________________________________________________________\n",
      "Layer (type)                    Output Shape         Param #     Connected to                     \n",
      "==================================================================================================\n",
      "input_2 (InputLayer)            [(None, 150)]        0                                            \n",
      "__________________________________________________________________________________________________\n",
      "input_3 (InputLayer)            [(None, 150)]        0                                            \n",
      "__________________________________________________________________________________________________\n",
      "input_1 (InputLayer)            [(None, 150)]        0                                            \n",
      "__________________________________________________________________________________________________\n",
      "dense (Dense)                   (None, 64)           9664        input_2[0][0]                    \n",
      "__________________________________________________________________________________________________\n",
      "dense_1 (Dense)                 (None, 64)           9664        input_3[0][0]                    \n",
      "__________________________________________________________________________________________________\n",
      "input_4 (InputLayer)            [(None, 150)]        0                                            \n",
      "__________________________________________________________________________________________________\n",
      "embedding (Embedding)           (None, 150, 200)     112400      input_1[0][0]                    \n",
      "__________________________________________________________________________________________________\n",
      "tf.concat (TFOpLambda)          (None, 128)          0           dense[0][0]                      \n",
      "                                                                 dense_1[0][0]                    \n",
      "__________________________________________________________________________________________________\n",
      "dense_2 (Dense)                 (None, 128)          19328       input_4[0][0]                    \n",
      "__________________________________________________________________________________________________\n",
      "bidirectional (Bidirectional)   (None, 150, 256)     336896      embedding[0][0]                  \n",
      "__________________________________________________________________________________________________\n",
      "tf.concat_1 (TFOpLambda)        (None, 256)          0           tf.concat[0][0]                  \n",
      "                                                                 dense_2[0][0]                    \n",
      "__________________________________________________________________________________________________\n",
      "attention (Attention)           (None, 256)          406         bidirectional[0][0]              \n",
      "__________________________________________________________________________________________________\n",
      "tf.concat_2 (TFOpLambda)        (None, 512)          0           tf.concat_1[0][0]                \n",
      "                                                                 attention[0][0]                  \n",
      "__________________________________________________________________________________________________\n",
      "dense_3 (Dense)                 (None, 64)           32832       tf.concat_2[0][0]                \n",
      "__________________________________________________________________________________________________\n",
      "dense_4 (Dense)                 (None, 6)            390         dense_3[0][0]                    \n",
      "==================================================================================================\n",
      "Total params: 521,580\n",
      "Trainable params: 521,580\n",
      "Non-trainable params: 0\n",
      "__________________________________________________________________________________________________\n"
     ]
    }
   ],
   "source": [
    "sequence_input = Input(shape=(MAX_SEQUENCE_LENGTH,), dtype='int32')\n",
    "pos1_input = Input(shape=(MAX_SEQUENCE_LENGTH,), dtype='int32')\n",
    "pos2_input = Input(shape=(MAX_SEQUENCE_LENGTH,), dtype='int32')\n",
    "e_input = Input(shape=(MAX_SEQUENCE_LENGTH,), dtype='int32')\n",
    "\n",
    "word_embedding = word_embeds(sequence_input)\n",
    "print(\"word_embedding:\",word_embedding.shape)\n",
    "word_embedding = Bidirectional(LSTM(128, return_sequences=True))(word_embedding)\n",
    "print(\"word_embedding:\",word_embedding.shape)\n",
    "word_embedding = Attention(MAX_SEQUENCE_LENGTH)(word_embedding)\n",
    "print(\"word_embedding:\",word_embedding.shape)\n",
    "\n",
    "#pos1_embedding =  pos1_embeds(pos1_input)\n",
    "#pos2_embedding =  pos2_embeds(pos2_input)\n",
    "#e_embedding = e_embeds(e_input)\n",
    "pos1 = Dense(64,input_shape=(input,))(pos1_input)\n",
    "pos2 = Dense(64,input_shape=(input,))(pos2_input)\n",
    "e = Dense(128,input_shape=(input,))(e_input)\n",
    "\n",
    "print(\"pos1:\",pos1)\n",
    "print(\"pos2:\",pos2)\n",
    "print(\"e:\",e)\n",
    "\n",
    "pos = tf.concat([pos1,pos2], 1)\n",
    "print(\"pos:\",pos)\n",
    "pos_e = tf.concat([pos,e], 1)\n",
    "print(\"pos_e:\",pos_e)\n",
    "\n",
    "#pos_e_lstm = Bidirectional(LSTM(128))(pos_e)\n",
    "#print(\"pos_e_lstm:\",pos_e_lstm)\n",
    "feature = tf.concat([pos_e,word_embedding], 1)\n",
    "print(\"feature:\",feature)\n",
    "\n",
    "feature = Dense(64)(feature)\n",
    "print(\"feature:\",feature)\n",
    "\n",
    "preds = Dense(len(relation2id), activation='softmax')(feature)\n",
    "\n",
    "model = Model([sequence_input,pos1_input,pos2_input, e_input],preds)\n",
    "\n",
    "model.compile(loss='categorical_crossentropy',\n",
    "              optimizer='adam',\n",
    "              metrics=['acc'])\n",
    "\n",
    "print(\"Bidirectional LSTM\")\n",
    "model.summary()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "metadata": {},
   "outputs": [],
   "source": [
    "#Train = tf.concat([train,position1,position2,E],1)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "metadata": {},
   "outputs": [],
   "source": [
    "#Train.shape"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "metadata": {},
   "outputs": [],
   "source": [
    "#Test = tf.concat([test,position1_t,position2_t,E_t],1)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "metadata": {},
   "outputs": [],
   "source": [
    "#Test.shape"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "metadata": {},
   "outputs": [],
   "source": [
    "labels = pd.DataFrame(labels)\n",
    "labels = pd.get_dummies(labels[0])\n",
    "labels = np.asarray(labels)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 12,
   "metadata": {},
   "outputs": [],
   "source": [
    "labels_t = pd.DataFrame(labels_t)\n",
    "labels_t = pd.get_dummies(labels_t[0])\n",
    "labels_t = np.asarray(labels_t)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 13,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "(2064, 6)"
      ]
     },
     "execution_count": 13,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "labels.shape"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 14,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "(688, 6)"
      ]
     },
     "execution_count": 14,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "labels_t.shape"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 15,
   "metadata": {
    "colab": {
     "autoexec": {
      "startup": false,
      "wait_interval": 0
     },
     "base_uri": "https://localhost:8080/",
     "height": 1074
    },
    "colab_type": "code",
    "executionInfo": {
     "elapsed": 1702650,
     "status": "ok",
     "timestamp": 1530792237299,
     "user": {
      "displayName": "Akshat Maheshwari",
      "photoUrl": "//lh5.googleusercontent.com/-f-xJkriVoaI/AAAAAAAAAAI/AAAAAAAAAVQ/TLGa4qObGgQ/s50-c-k-no/photo.jpg",
      "userId": "114426356464940466000"
     },
     "user_tz": -330
    },
    "id": "S4xfBNtKLdD2",
    "outputId": "5a3abcce-be20-4c71-c989-5ebc191f064d",
    "scrolled": true
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Epoch 1/50\n",
      "33/33 [==============================] - 28s 680ms/step - loss: 20.5680 - acc: 0.3880\n",
      "WARNING:tensorflow:Can save best model only with val_acc available, skipping.\n",
      "Epoch 2/50\n",
      "33/33 [==============================] - 23s 682ms/step - loss: 3.9454 - acc: 0.5189\n",
      "WARNING:tensorflow:Can save best model only with val_acc available, skipping.\n",
      "Epoch 3/50\n",
      "33/33 [==============================] - 23s 679ms/step - loss: 1.8271 - acc: 0.5801\n",
      "WARNING:tensorflow:Can save best model only with val_acc available, skipping.\n",
      "Epoch 4/50\n",
      "33/33 [==============================] - 23s 705ms/step - loss: 1.7112 - acc: 0.5774\n",
      "WARNING:tensorflow:Can save best model only with val_acc available, skipping.\n",
      "Epoch 5/50\n",
      "33/33 [==============================] - 23s 692ms/step - loss: 1.4150 - acc: 0.6240\n",
      "WARNING:tensorflow:Can save best model only with val_acc available, skipping.\n",
      "Epoch 6/50\n",
      "33/33 [==============================] - 23s 704ms/step - loss: 1.4781 - acc: 0.6178\n",
      "WARNING:tensorflow:Can save best model only with val_acc available, skipping.\n",
      "Epoch 7/50\n",
      "33/33 [==============================] - 23s 685ms/step - loss: 1.1259 - acc: 0.6760\n",
      "WARNING:tensorflow:Can save best model only with val_acc available, skipping.\n",
      "Epoch 8/50\n",
      "33/33 [==============================] - 22s 677ms/step - loss: 0.9314 - acc: 0.6975\n",
      "WARNING:tensorflow:Can save best model only with val_acc available, skipping.\n",
      "Epoch 9/50\n",
      "33/33 [==============================] - 24s 734ms/step - loss: 1.0978 - acc: 0.7087\n",
      "WARNING:tensorflow:Can save best model only with val_acc available, skipping.\n",
      "Epoch 10/50\n",
      "33/33 [==============================] - 24s 730ms/step - loss: 1.2125 - acc: 0.6714\n",
      "WARNING:tensorflow:Can save best model only with val_acc available, skipping.\n",
      "Epoch 11/50\n",
      "33/33 [==============================] - 24s 728ms/step - loss: 1.1376 - acc: 0.7145\n",
      "WARNING:tensorflow:Can save best model only with val_acc available, skipping.\n",
      "Epoch 12/50\n",
      "33/33 [==============================] - 22s 656ms/step - loss: 0.8986 - acc: 0.7353\n",
      "WARNING:tensorflow:Can save best model only with val_acc available, skipping.\n",
      "Epoch 13/50\n",
      "33/33 [==============================] - 22s 666ms/step - loss: 0.7525 - acc: 0.7543\n",
      "WARNING:tensorflow:Can save best model only with val_acc available, skipping.\n",
      "Epoch 14/50\n",
      "33/33 [==============================] - 23s 689ms/step - loss: 0.6441 - acc: 0.7558\n",
      "WARNING:tensorflow:Can save best model only with val_acc available, skipping.\n",
      "Epoch 15/50\n",
      "33/33 [==============================] - 22s 681ms/step - loss: 0.5658 - acc: 0.7913\n",
      "WARNING:tensorflow:Can save best model only with val_acc available, skipping.\n",
      "Epoch 16/50\n",
      "33/33 [==============================] - 22s 667ms/step - loss: 0.7742 - acc: 0.7533\n",
      "WARNING:tensorflow:Can save best model only with val_acc available, skipping.\n",
      "Epoch 17/50\n",
      "33/33 [==============================] - 22s 671ms/step - loss: 0.6578 - acc: 0.7620\n",
      "WARNING:tensorflow:Can save best model only with val_acc available, skipping.\n",
      "Epoch 18/50\n",
      "33/33 [==============================] - 25s 768ms/step - loss: 0.7900 - acc: 0.7642\n",
      "WARNING:tensorflow:Can save best model only with val_acc available, skipping.\n",
      "Epoch 19/50\n",
      "33/33 [==============================] - ETA: 0s - loss: 0.7393 - acc: 0.737 - 27s 812ms/step - loss: 0.7382 - acc: 0.7377\n",
      "WARNING:tensorflow:Can save best model only with val_acc available, skipping.\n",
      "Epoch 20/50\n",
      "33/33 [==============================] - 23s 688ms/step - loss: 0.7469 - acc: 0.7440\n",
      "WARNING:tensorflow:Can save best model only with val_acc available, skipping.\n",
      "Epoch 21/50\n",
      "33/33 [==============================] - 23s 682ms/step - loss: 0.5631 - acc: 0.8038\n",
      "WARNING:tensorflow:Can save best model only with val_acc available, skipping.\n",
      "Epoch 22/50\n",
      "33/33 [==============================] - 22s 672ms/step - loss: 0.6000 - acc: 0.7823\n",
      "WARNING:tensorflow:Can save best model only with val_acc available, skipping.\n",
      "Epoch 23/50\n",
      "33/33 [==============================] - 22s 682ms/step - loss: 0.6203 - acc: 0.7882\n",
      "WARNING:tensorflow:Can save best model only with val_acc available, skipping.\n",
      "Epoch 24/50\n",
      "33/33 [==============================] - 23s 692ms/step - loss: 0.4941 - acc: 0.8118\n",
      "WARNING:tensorflow:Can save best model only with val_acc available, skipping.\n",
      "Epoch 25/50\n",
      "33/33 [==============================] - 22s 673ms/step - loss: 0.5748 - acc: 0.7884\n",
      "WARNING:tensorflow:Can save best model only with val_acc available, skipping.\n",
      "Epoch 26/50\n",
      "33/33 [==============================] - 22s 662ms/step - loss: 0.5001 - acc: 0.8108\n",
      "WARNING:tensorflow:Can save best model only with val_acc available, skipping.\n",
      "Epoch 27/50\n",
      "33/33 [==============================] - 21s 651ms/step - loss: 0.5845 - acc: 0.79650s - loss: 0.5845 - acc: 0.796\n",
      "WARNING:tensorflow:Can save best model only with val_acc available, skipping.\n",
      "Epoch 28/50\n",
      "33/33 [==============================] - 22s 659ms/step - loss: 0.4841 - acc: 0.8262\n",
      "WARNING:tensorflow:Can save best model only with val_acc available, skipping.\n",
      "Epoch 29/50\n",
      "33/33 [==============================] - 23s 685ms/step - loss: 0.5142 - acc: 0.8132\n",
      "WARNING:tensorflow:Can save best model only with val_acc available, skipping.\n",
      "Epoch 30/50\n",
      "33/33 [==============================] - 23s 687ms/step - loss: 0.5195 - acc: 0.8225\n",
      "WARNING:tensorflow:Can save best model only with val_acc available, skipping.\n",
      "Epoch 31/50\n",
      "33/33 [==============================] - 23s 684ms/step - loss: 0.4754 - acc: 0.8083\n",
      "WARNING:tensorflow:Can save best model only with val_acc available, skipping.\n",
      "Epoch 32/50\n",
      "33/33 [==============================] - 22s 665ms/step - loss: 0.4484 - acc: 0.8104\n",
      "WARNING:tensorflow:Can save best model only with val_acc available, skipping.\n",
      "Epoch 33/50\n",
      "33/33 [==============================] - 22s 677ms/step - loss: 0.5152 - acc: 0.8046\n",
      "WARNING:tensorflow:Can save best model only with val_acc available, skipping.\n",
      "Epoch 34/50\n",
      "33/33 [==============================] - 23s 689ms/step - loss: 0.4374 - acc: 0.8239\n",
      "WARNING:tensorflow:Can save best model only with val_acc available, skipping.\n",
      "Epoch 35/50\n",
      "33/33 [==============================] - 22s 653ms/step - loss: 0.4150 - acc: 0.8281\n",
      "WARNING:tensorflow:Can save best model only with val_acc available, skipping.\n",
      "Epoch 36/50\n",
      "33/33 [==============================] - 22s 670ms/step - loss: 0.4893 - acc: 0.8135\n",
      "WARNING:tensorflow:Can save best model only with val_acc available, skipping.\n",
      "Epoch 37/50\n",
      "33/33 [==============================] - 22s 671ms/step - loss: 0.5086 - acc: 0.8105\n",
      "WARNING:tensorflow:Can save best model only with val_acc available, skipping.\n",
      "Epoch 38/50\n",
      "33/33 [==============================] - 22s 662ms/step - loss: 0.5069 - acc: 0.7978\n",
      "WARNING:tensorflow:Can save best model only with val_acc available, skipping.\n",
      "Epoch 39/50\n",
      "33/33 [==============================] - 23s 694ms/step - loss: 0.4051 - acc: 0.8366\n",
      "WARNING:tensorflow:Can save best model only with val_acc available, skipping.\n",
      "Epoch 40/50\n",
      "33/33 [==============================] - 22s 661ms/step - loss: 0.4107 - acc: 0.8403\n",
      "WARNING:tensorflow:Can save best model only with val_acc available, skipping.\n",
      "Epoch 41/50\n",
      "33/33 [==============================] - 23s 700ms/step - loss: 0.4026 - acc: 0.8374\n",
      "WARNING:tensorflow:Can save best model only with val_acc available, skipping.\n",
      "Epoch 42/50\n",
      "33/33 [==============================] - 26s 793ms/step - loss: 0.3928 - acc: 0.8425\n",
      "WARNING:tensorflow:Can save best model only with val_acc available, skipping.\n",
      "Epoch 43/50\n",
      "33/33 [==============================] - 24s 731ms/step - loss: 0.4172 - acc: 0.8288\n",
      "WARNING:tensorflow:Can save best model only with val_acc available, skipping.\n",
      "Epoch 44/50\n",
      "33/33 [==============================] - 24s 718ms/step - loss: 0.4734 - acc: 0.8116\n",
      "WARNING:tensorflow:Can save best model only with val_acc available, skipping.\n",
      "Epoch 45/50\n",
      "33/33 [==============================] - 24s 717ms/step - loss: 0.4270 - acc: 0.8239\n",
      "WARNING:tensorflow:Can save best model only with val_acc available, skipping.\n",
      "Epoch 46/50\n",
      "33/33 [==============================] - 24s 729ms/step - loss: 0.4069 - acc: 0.8359\n",
      "WARNING:tensorflow:Can save best model only with val_acc available, skipping.\n",
      "Epoch 47/50\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "33/33 [==============================] - 27s 827ms/step - loss: 0.4428 - acc: 0.8285\n",
      "WARNING:tensorflow:Can save best model only with val_acc available, skipping.\n",
      "Epoch 48/50\n",
      "33/33 [==============================] - 24s 737ms/step - loss: 0.4008 - acc: 0.8380\n",
      "WARNING:tensorflow:Can save best model only with val_acc available, skipping.\n",
      "Epoch 49/50\n",
      "33/33 [==============================] - 24s 734ms/step - loss: 0.3907 - acc: 0.8488\n",
      "WARNING:tensorflow:Can save best model only with val_acc available, skipping.\n",
      "Epoch 50/50\n",
      "33/33 [==============================] - 23s 707ms/step - loss: 0.3667 - acc: 0.8439\n",
      "WARNING:tensorflow:Can save best model only with val_acc available, skipping.\n"
     ]
    }
   ],
   "source": [
    "cp = ModelCheckpoint('model_bilstm.hdf5',monitor='val_acc',verbose=1,save_best_only=True)\n",
    "history = model.fit([train,position1,position2,E], labels,epochs= 50, batch_size = 64,callbacks=[cp])"
   ]
  },
  {
   "cell_type": "code",
   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je8/fbbDBkyhJNOOolbbrmFYcOGccIJJ7BgwQIA5s2bx/3330+LFi2YOHEiX3zxBc899xxPPvkkn3zyyWrL8eqrr65TvZKad2+f3H0vFi0qbDlEpKBGjBgBQFFRhLySkpKVn3366acUFRXRuXNnrr/+el5++WUuvfRSzj77bIqLi2ndujUQrfuHHnqI9u3bc+GFF+LuTJ8+nSlTpjBjxgwef/zx1ZZh+PDhPP30041Uw7pr3sE/1/JX8BcpvJ/8BJJ0S4PZdlu47LIaP3744Ye54oor6NWrF/fcc8/K4J8+QTpt2jQeffRRHnvsMa655hp23nlnli1bxgMPPMC5557LMcccA8CMGTMYNWoUkydP5rTTTqOiooKbb76ZM888k5kzZ9KjR486F/8Pf/gD/fr1Y+rUqZxwwgm0adOGcePGUVpaytixY7nqqqvo27dvtdPWVvMO/rmWv9I+Ipk0cuRIRo4cyYUXXgjAihUrgKrBf+jQoVxxxRW0bduWHj16sHjxYjp16sT8+fO55ppruOmmm7j77rvZfPPNAXj//fc58cQTV7b8J0+ezNKlS9lvv/246KKLal22xx9/nE022YQRI0bQvXt37rzzTk455RSeffZZrrrqKnbddVcWL14MUO20tZWN4K+Wv0jhXX9946z3q69qNVtFRcXK3H+618+LL77ImDFjOOaYY1i6dClPPvkkJSUlTJgwgYqKCvbcc88q6zn++OP53ve+x2uvvcbHH3/MAQccAMDUqVNZtmxZra+ynTRpEgcffDAA/fr146abbgLgjDPO4Mwzz6R79+5ccsklNU5bW9k44avgL5JpCxYs4Omnn6ZDhw5A5REAwJAhQ7jjjjsYPHgwCxYsYOzYsTz44IMAfP7554wZM4alS5dy7733stNOO3HDDTewxx57sMsuu3D66aczbNgwhg0bximnnFKnnP7AgQOZMWMGECmlAQMG4O4sWbKEO+64g6FDh/Loo49WO60hZKPlr7SPSGYtWLCAN998k8GDB3P88ccDlS3/5cuXM3HiRG6//XYOOuggNt98c9q0acMRRxzBE088QVlZGV27duW6667jggsu4LDDDmPp0qVcffXVnHjiiRQVFbFkyRKOPvrolSe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blLyIiNVPwFxHJIAV/EZEMUvAXEckgBX+RJmZmo8ysd6HLIdmm4C/ShMxsV+BXhS6HiIK/SBNy9+eADwpdDhEFfxGRDGrW9/MXWZPkfinnE88D6AE8D0wBxgKTiBtnLU8+u8zdZybLdQfOBd5JPpvi7n9LrXcHYF/iZnNDgGvdfVZq0zua2alAO6Ctu/+wEaspsgoFf8m6q4C/uvvzZmZE8D8KuBM4DtjH3ZeZ2UDgD8T9VQD+CJzg7v8FMLN7zOwtd383udHcGGBPd68wsw2As4mdRU4Pd78gWfYxM9vK3d9p/OqKBKV9JLPMrAVwgLs/D+Bxr5PxwN7JLE+7+7LksynA1mbWyswGAd/kAn/iL8DpyfhxwIPuXpG8/ytwXd7m/5Ya/wTYqIGqJVIravlLlnUFWpnZkalpS4lb43aoZv7cPdP7EQE77ROgbzLem9iJAODun9eiLFa7Ios0DAV/ybLPgRXuPi7/AzMbXc38nYhzAx8RD09J60rls1VnAxvmrW8Dd5+HyDpCaR/JLHdfAZSb2S65aWY22Mz6JW/7pqbvBTyeLPMK0N7M2qdWdwBwazJ+H3BIklbKSR9diBScbuksmWZmHYFLiVTP18AH7v5A0vLfn3hGQAmwGfBzd5+fLNcLOBWYCrRNlnsstd7vA/sA04mUzt3uPiN50PrfgFvd/Qoz2woYR5xoPtvdlzZ+rUUU/EWqlQT/3u7+ywIXRaRRKO0jksfMugH7AcOTLp4izY5a/iIiGaSWv4hIBin4i4hkkIK/iEgGKfiLiGSQgr+ISAYp+IuIZND/Bw+hZIIS3gvoAAAAAElFTkSuQmCC\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "plt.rcParams['font.sans-serif']=['simsun'] #用来正常显示中文标签\n",
    "plt.rcParams['axes.unicode_minus']=False #用来正常显示负号\n",
    "\n",
    "fig, ax = plt.subplots()#创建一个figure \n",
    "ax.plot(history.history['loss'], '-r', label='训练集 loss')\n",
    "\n",
    "####打开网格\n",
    "ax.grid(True)\n",
    "\n",
    "####定义x, y轴的名称\n",
    "ax.set_xlabel('epoch',fontsize=15)\n",
    "ax.set_ylabel('loss',fontsize=15)\n",
    "\n",
    "####定义标题\n",
    "fig.suptitle('BiLSTM-ATTENTION模型损失函数变化曲线',fontsize=15)\n",
    "\n",
    "####展示图例 legend loc=是用来定义图例的位置的，还有很多选择，大家可以自己尝试\n",
    "ax.legend(loc = 'upper right')\n",
    "\n",
    "plt.savefig(\"BiLSTM-ATTENTION模型损失函数变化曲线.png\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 17,
   "metadata": {},
   "outputs": [],
   "source": [
    "pred_test = model.predict([test,position1_t,position2_t,E_t])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 18,
   "metadata": {
    "scrolled": true
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "50"
      ]
     },
     "execution_count": 18,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "len(history.history['loss'])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 19,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "[11.346717834472656,\n",
       " 3.040113925933838,\n",
       " 1.6086716651916504,\n",
       " 1.6339318752288818,\n",
       " 1.3905282020568848,\n",
       " 1.2992615699768066,\n",
       " 1.1412734985351562,\n",
       " 0.8667906522750854,\n",
       " 1.0843898057937622,\n",
       " 1.1677623987197876,\n",
       " 1.0375237464904785,\n",
       " 0.8658561706542969,\n",
       " 0.7910088896751404,\n",
       " 0.6439255475997925,\n",
       " 0.6379189491271973,\n",
       " 0.7595102787017822,\n",
       " 0.6347583532333374,\n",
       " 0.8475263714790344,\n",
       " 0.7023013830184937,\n",
       " 0.7185420989990234,\n",
       " 0.559404194355011,\n",
       " 0.642833411693573,\n",
       " 0.5913205742835999,\n",
       " 0.5197020769119263,\n",
       " 0.5616215467453003,\n",
       " 0.5240775346755981,\n",
       " 0.5838339924812317,\n",
       " 0.4706699252128601,\n",
       " 0.5219316482543945,\n",
       " 0.5454595685005188,\n",
       " 0.47962963581085205,\n",
       " 0.46874138712882996,\n",
       " 0.5135476589202881,\n",
       " 0.4689042568206787,\n",
       " 0.4222675859928131,\n",
       " 0.48430511355400085,\n",
       " 0.5017298460006714,\n",
       " 0.47211024165153503,\n",
       " 0.421494722366333,\n",
       " 0.40249937772750854,\n",
       " 0.4154009521007538,\n",
       " 0.3959157168865204,\n",
       " 0.4270186722278595,\n",
       " 0.4418235719203949,\n",
       " 0.4432675242424011,\n",
       " 0.4468246102333069,\n",
       " 0.46086159348487854,\n",
       " 0.415639191865921,\n",
       " 0.3852802515029907,\n",
       " 0.3653233051300049]"
      ]
     },
     "execution_count": 19,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "history.history['loss']"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 20,
   "metadata": {
    "scrolled": true
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([[0, 0, 0, 1, 0, 0],\n",
       "       [0, 0, 0, 0, 1, 0],\n",
       "       [1, 0, 0, 0, 0, 0],\n",
       "       ...,\n",
       "       [1, 0, 0, 0, 0, 0],\n",
       "       [0, 0, 0, 1, 0, 0],\n",
       "       [0, 0, 0, 0, 0, 1]], dtype=uint8)"
      ]
     },
     "execution_count": 20,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "labels_t"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 21,
   "metadata": {
    "colab": {
     "autoexec": {
      "startup": false,
      "wait_interval": 0
     }
    },
    "colab_type": "code",
    "id": "zdU_K2hMomOJ"
   },
   "outputs": [],
   "source": [
    "res = model.predict([test,position1_t,position2_t,E_t])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 22,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([[9.95501409e-07, 1.49141485e-03, 1.69380009e-01, 8.29127491e-01,\n",
       "        3.39981376e-08, 1.01508505e-07],\n",
       "       [2.86629017e-07, 1.68562210e-07, 5.20551344e-04, 3.72925820e-06,\n",
       "        9.49310422e-01, 5.01648113e-02],\n",
       "       [7.91935742e-01, 1.28055282e-04, 6.62622199e-07, 6.79742596e-10,\n",
       "        1.65711401e-06, 2.07933843e-01],\n",
       "       ...,\n",
       "       [3.14280540e-01, 1.02082446e-07, 1.72127293e-05, 9.95970098e-08,\n",
       "        3.20062338e-10, 6.85702026e-01],\n",
       "       [4.97032193e-09, 3.24955327e-04, 8.84964883e-01, 1.14708833e-01,\n",
       "        1.02100381e-08, 1.40856491e-06],\n",
       "       [1.55347415e-08, 3.85225540e-08, 1.94977317e-03, 6.77727041e-10,\n",
       "        9.70312589e-13, 9.98050213e-01]], dtype=float32)"
      ]
     },
     "execution_count": 22,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "res"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 23,
   "metadata": {},
   "outputs": [],
   "source": [
    "result = []\n",
    "for item in res:\n",
    "    ls = list(item)\n",
    "    idx = ls.index(max(ls))\n",
    "    add_ls = [0]*6\n",
    "    add_ls[idx] = 1\n",
    "    result.append(add_ls)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 24,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "[[0, 0, 0, 1, 0, 0],\n",
       " [0, 0, 0, 0, 1, 0],\n",
       " [1, 0, 0, 0, 0, 0],\n",
       " [0, 1, 0, 0, 0, 0],\n",
       " [0, 0, 0, 0, 0, 1],\n",
       " [0, 0, 0, 0, 0, 1],\n",
       " [0, 0, 1, 0, 0, 0],\n",
       " [1, 0, 0, 0, 0, 0],\n",
       " [0, 0, 0, 0, 0, 1],\n",
       " [0, 0, 0, 1, 0, 0],\n",
       " [1, 0, 0, 0, 0, 0],\n",
       " [0, 0, 0, 0, 0, 1],\n",
       " [0, 0, 0, 0, 0, 1],\n",
       " [0, 1, 0, 0, 0, 0],\n",
       " [1, 0, 0, 0, 0, 0],\n",
       " [0, 0, 1, 0, 0, 0],\n",
       " [0, 0, 0, 0, 1, 0],\n",
       " [0, 0, 0, 0, 0, 1],\n",
       " [1, 0, 0, 0, 0, 0],\n",
       " [0, 1, 0, 0, 0, 0],\n",
       " [1, 0, 0, 0, 0, 0],\n",
       " [1, 0, 0, 0, 0, 0],\n",
       " [1, 0, 0, 0, 0, 0],\n",
       " [1, 0, 0, 0, 0, 0],\n",
       " [0, 0, 0, 0, 1, 0],\n",
       " [1, 0, 0, 0, 0, 0],\n",
       " [0, 0, 0, 0, 0, 1],\n",
       " [0, 0, 0, 0, 0, 1],\n",
       " [1, 0, 0, 0, 0, 0],\n",
       " [1, 0, 0, 0, 0, 0],\n",
       " [0, 1, 0, 0, 0, 0],\n",
       " [1, 0, 0, 0, 0, 0],\n",
       " [0, 0, 0, 0, 0, 1],\n",
       " [0, 0, 0, 0, 0, 1],\n",
       " [1, 0, 0, 0, 0, 0],\n",
       " [0, 0, 0, 0, 0, 1],\n",
       " [1, 0, 0, 0, 0, 0],\n",
       " [0, 1, 0, 0, 0, 0],\n",
       " [1, 0, 0, 0, 0, 0],\n",
       " [0, 1, 0, 0, 0, 0],\n",
       " [0, 0, 0, 1, 0, 0],\n",
       " [0, 0, 0, 0, 0, 1],\n",
       " [1, 0, 0, 0, 0, 0],\n",
       " [1, 0, 0, 0, 0, 0],\n",
       " [0, 0, 0, 0, 0, 1],\n",
       " [0, 1, 0, 0, 0, 0],\n",
       " [0, 0, 1, 0, 0, 0],\n",
       " [0, 0, 0, 0, 0, 1],\n",
       " [1, 0, 0, 0, 0, 0],\n",
       " [0, 0, 0, 0, 0, 1],\n",
       " [1, 0, 0, 0, 0, 0],\n",
       " [1, 0, 0, 0, 0, 0],\n",
       " [1, 0, 0, 0, 0, 0],\n",
       " [1, 0, 0, 0, 0, 0],\n",
       " [0, 0, 0, 0, 0, 1],\n",
       " [0, 0, 0, 0, 0, 1],\n",
       " [1, 0, 0, 0, 0, 0],\n",
       " [1, 0, 0, 0, 0, 0],\n",
       " [0, 1, 0, 0, 0, 0],\n",
       " [0, 0, 0, 0, 0, 1],\n",
       " [0, 0, 0, 0, 1, 0],\n",
       " [1, 0, 0, 0, 0, 0],\n",
       " [0, 0, 0, 0, 0, 1],\n",
       " [0, 0, 0, 0, 0, 1],\n",
       " [1, 0, 0, 0, 0, 0],\n",
       " [1, 0, 0, 0, 0, 0],\n",
       " [1, 0, 0, 0, 0, 0],\n",
       " [0, 0, 0, 0, 0, 1],\n",
       " [0, 0, 0, 0, 0, 1],\n",
       " [0, 0, 0, 0, 0, 1],\n",
       " [0, 0, 1, 0, 0, 0],\n",
       " [0, 0, 0, 0, 0, 1],\n",
       " [0, 0, 0, 0, 0, 1],\n",
       " [1, 0, 0, 0, 0, 0],\n",
       " [0, 0, 1, 0, 0, 0],\n",
       " [0, 0, 0, 1, 0, 0],\n",
       " [1, 0, 0, 0, 0, 0],\n",
       " [0, 1, 0, 0, 0, 0],\n",
       " [0, 0, 0, 0, 0, 1],\n",
       " [0, 0, 0, 0, 0, 1],\n",
       " [0, 1, 0, 0, 0, 0],\n",
       " [0, 0, 0, 0, 0, 1],\n",
       " [1, 0, 0, 0, 0, 0],\n",
       " [1, 0, 0, 0, 0, 0],\n",
       " [1, 0, 0, 0, 0, 0],\n",
       " [0, 0, 0, 0, 0, 1],\n",
       " [0, 0, 0, 0, 0, 1],\n",
       " [0, 1, 0, 0, 0, 0],\n",
       " [0, 0, 0, 0, 1, 0],\n",
       " [0, 0, 0, 1, 0, 0],\n",
       " [0, 0, 1, 0, 0, 0],\n",
       " [1, 0, 0, 0, 0, 0],\n",
       " [0, 0, 0, 1, 0, 0],\n",
       " [0, 0, 0, 0, 0, 1],\n",
       " [0, 0, 0, 0, 0, 1],\n",
       " [0, 0, 0, 0, 0, 1],\n",
       " [0, 0, 0, 0, 0, 1],\n",
       " [1, 0, 0, 0, 0, 0],\n",
       " [0, 0, 0, 0, 0, 1],\n",
       " [0, 0, 0, 0, 0, 1],\n",
       " [1, 0, 0, 0, 0, 0],\n",
       " [0, 0, 0, 0, 0, 1],\n",
       " [1, 0, 0, 0, 0, 0],\n",
       " [0, 1, 0, 0, 0, 0],\n",
       " [1, 0, 0, 0, 0, 0],\n",
       " [0, 0, 0, 1, 0, 0],\n",
       " [1, 0, 0, 0, 0, 0],\n",
       " [0, 0, 0, 0, 0, 1],\n",
       " [0, 0, 1, 0, 0, 0],\n",
       " [1, 0, 0, 0, 0, 0],\n",
       " [1, 0, 0, 0, 0, 0],\n",
       " [0, 0, 1, 0, 0, 0],\n",
       " [1, 0, 0, 0, 0, 0],\n",
       " [0, 0, 0, 0, 1, 0],\n",
       " [0, 0, 0, 0, 0, 1],\n",
       " [0, 0, 0, 0, 0, 1],\n",
       " [0, 1, 0, 0, 0, 0],\n",
       " [0, 0, 0, 0, 0, 1],\n",
       " [0, 0, 0, 0, 1, 0],\n",
       " [1, 0, 0, 0, 0, 0],\n",
       " [1, 0, 0, 0, 0, 0],\n",
       " [1, 0, 0, 0, 0, 0],\n",
       " [1, 0, 0, 0, 0, 0],\n",
       " [0, 0, 0, 0, 0, 1],\n",
       " [1, 0, 0, 0, 0, 0],\n",
       " [0, 0, 0, 0, 0, 1],\n",
       " [1, 0, 0, 0, 0, 0],\n",
       " [1, 0, 0, 0, 0, 0],\n",
       " [0, 0, 0, 0, 0, 1],\n",
       " [0, 0, 0, 0, 0, 1],\n",
       " [0, 0, 0, 0, 0, 1],\n",
       " [1, 0, 0, 0, 0, 0],\n",
       " [0, 0, 0, 0, 0, 1],\n",
       " [1, 0, 0, 0, 0, 0],\n",
       " [1, 0, 0, 0, 0, 0],\n",
       " [1, 0, 0, 0, 0, 0],\n",
       " [1, 0, 0, 0, 0, 0],\n",
       " [1, 0, 0, 0, 0, 0],\n",
       " [1, 0, 0, 0, 0, 0],\n",
       " [0, 0, 0, 0, 0, 1],\n",
       " [0, 0, 0, 0, 1, 0],\n",
       " [1, 0, 0, 0, 0, 0],\n",
       " [0, 0, 0, 0, 0, 1],\n",
       " [1, 0, 0, 0, 0, 0],\n",
       " [0, 0, 0, 0, 0, 1],\n",
       " [0, 0, 0, 0, 0, 1],\n",
       " [1, 0, 0, 0, 0, 0],\n",
       " [1, 0, 0, 0, 0, 0],\n",
       " [1, 0, 0, 0, 0, 0],\n",
       " [0, 0, 1, 0, 0, 0],\n",
       " [0, 0, 0, 0, 0, 1],\n",
       " [0, 0, 0, 1, 0, 0],\n",
       " [0, 0, 0, 0, 0, 1],\n",
       " [0, 0, 0, 0, 0, 1],\n",
       " [1, 0, 0, 0, 0, 0],\n",
       " [1, 0, 0, 0, 0, 0],\n",
       " [0, 1, 0, 0, 0, 0],\n",
       " [0, 0, 0, 0, 0, 1],\n",
       " [0, 0, 0, 1, 0, 0],\n",
       " [1, 0, 0, 0, 0, 0],\n",
       " [1, 0, 0, 0, 0, 0],\n",
       " [1, 0, 0, 0, 0, 0],\n",
       " [1, 0, 0, 0, 0, 0],\n",
       " [1, 0, 0, 0, 0, 0],\n",
       " [0, 1, 0, 0, 0, 0],\n",
       " [0, 0, 1, 0, 0, 0],\n",
       " [0, 0, 0, 0, 0, 1],\n",
       " [0, 0, 0, 0, 0, 1],\n",
       " [1, 0, 0, 0, 0, 0],\n",
       " [0, 0, 0, 0, 0, 1],\n",
       " [0, 0, 0, 0, 0, 1],\n",
       " [0, 0, 0, 0, 0, 1],\n",
       " [1, 0, 0, 0, 0, 0],\n",
       " [1, 0, 0, 0, 0, 0],\n",
       " [0, 0, 0, 0, 0, 1],\n",
       " [0, 0, 0, 0, 0, 1],\n",
       " [0, 0, 0, 0, 0, 1],\n",
       " [0, 0, 1, 0, 0, 0],\n",
       " [0, 0, 1, 0, 0, 0],\n",
       " [1, 0, 0, 0, 0, 0],\n",
       " [0, 1, 0, 0, 0, 0],\n",
       " [0, 0, 0, 0, 0, 1],\n",
       " [0, 0, 0, 0, 0, 1],\n",
       " [1, 0, 0, 0, 0, 0],\n",
       " [1, 0, 0, 0, 0, 0],\n",
       " [1, 0, 0, 0, 0, 0],\n",
       " [0, 0, 0, 0, 1, 0],\n",
       " [0, 0, 0, 1, 0, 0],\n",
       " [1, 0, 0, 0, 0, 0],\n",
       " [1, 0, 0, 0, 0, 0],\n",
       " [0, 0, 0, 0, 0, 1],\n",
       " [0, 0, 0, 0, 0, 1],\n",
       " [0, 0, 0, 0, 0, 1],\n",
       " [0, 0, 0, 0, 1, 0],\n",
       " [0, 1, 0, 0, 0, 0],\n",
       " [1, 0, 0, 0, 0, 0],\n",
       " [0, 1, 0, 0, 0, 0],\n",
       " [0, 0, 0, 0, 0, 1],\n",
       " [1, 0, 0, 0, 0, 0],\n",
       " [1, 0, 0, 0, 0, 0],\n",
       " [1, 0, 0, 0, 0, 0],\n",
       " [0, 0, 0, 1, 0, 0],\n",
       " [0, 0, 0, 1, 0, 0],\n",
       " [0, 0, 0, 0, 1, 0],\n",
       " [0, 0, 0, 0, 0, 1],\n",
       " [1, 0, 0, 0, 0, 0],\n",
       " [0, 0, 0, 0, 0, 1],\n",
       " [0, 0, 0, 0, 0, 1],\n",
       " [0, 0, 0, 0, 0, 1],\n",
       " [0, 0, 0, 1, 0, 0],\n",
       " [1, 0, 0, 0, 0, 0],\n",
       " [0, 0, 0, 0, 0, 1],\n",
       " [1, 0, 0, 0, 0, 0],\n",
       " [1, 0, 0, 0, 0, 0],\n",
       " [0, 0, 0, 1, 0, 0],\n",
       " [1, 0, 0, 0, 0, 0],\n",
       " [0, 0, 1, 0, 0, 0],\n",
       " [0, 0, 0, 0, 0, 1],\n",
       " [0, 0, 0, 1, 0, 0],\n",
       " [0, 0, 0, 0, 0, 1],\n",
       " [0, 0, 0, 0, 0, 1],\n",
       " [1, 0, 0, 0, 0, 0],\n",
       " [0, 0, 1, 0, 0, 0],\n",
       " [1, 0, 0, 0, 0, 0],\n",
       " [1, 0, 0, 0, 0, 0],\n",
       " [0, 0, 1, 0, 0, 0],\n",
       " [0, 0, 1, 0, 0, 0],\n",
       " [0, 0, 0, 0, 0, 1],\n",
       " [0, 1, 0, 0, 0, 0],\n",
       " [1, 0, 0, 0, 0, 0],\n",
       " [0, 0, 0, 0, 0, 1],\n",
       " [0, 0, 0, 0, 0, 1],\n",
       " [0, 0, 0, 0, 0, 1],\n",
       " [1, 0, 0, 0, 0, 0],\n",
       " [1, 0, 0, 0, 0, 0],\n",
       " [0, 0, 0, 0, 0, 1],\n",
       " [0, 0, 0, 0, 0, 1],\n",
       " [1, 0, 0, 0, 0, 0],\n",
       " [1, 0, 0, 0, 0, 0],\n",
       " [1, 0, 0, 0, 0, 0],\n",
       " [0, 1, 0, 0, 0, 0],\n",
       " [1, 0, 0, 0, 0, 0],\n",
       " [1, 0, 0, 0, 0, 0],\n",
       " [0, 0, 0, 0, 0, 1],\n",
       " [0, 0, 0, 0, 0, 1],\n",
       " [1, 0, 0, 0, 0, 0],\n",
       " [0, 0, 1, 0, 0, 0],\n",
       " [0, 0, 0, 0, 1, 0],\n",
       " [1, 0, 0, 0, 0, 0],\n",
       " [0, 0, 0, 0, 0, 1],\n",
       " [1, 0, 0, 0, 0, 0],\n",
       " [0, 0, 0, 0, 0, 1],\n",
       " [0, 0, 0, 0, 0, 1],\n",
       " [0, 0, 1, 0, 0, 0],\n",
       " [0, 0, 0, 0, 1, 0],\n",
       " [0, 1, 0, 0, 0, 0],\n",
       " [0, 0, 0, 0, 0, 1],\n",
       " [0, 0, 0, 0, 0, 1],\n",
       " [0, 0, 0, 0, 0, 1],\n",
       " [0, 0, 0, 1, 0, 0],\n",
       " [0, 0, 0, 1, 0, 0],\n",
       " [0, 0, 0, 0, 0, 1],\n",
       " [0, 0, 1, 0, 0, 0],\n",
       " [0, 0, 0, 0, 0, 1],\n",
       " [0, 0, 0, 0, 0, 1],\n",
       " [0, 0, 0, 0, 0, 1],\n",
       " [1, 0, 0, 0, 0, 0],\n",
       " [0, 0, 0, 0, 0, 1],\n",
       " [1, 0, 0, 0, 0, 0],\n",
       " [1, 0, 0, 0, 0, 0],\n",
       " [1, 0, 0, 0, 0, 0],\n",
       " [1, 0, 0, 0, 0, 0],\n",
       " [0, 0, 0, 0, 1, 0],\n",
       " [0, 0, 0, 0, 0, 1],\n",
       " [0, 0, 0, 0, 0, 1],\n",
       " [0, 0, 0, 0, 0, 1],\n",
       " [1, 0, 0, 0, 0, 0],\n",
       " [0, 0, 1, 0, 0, 0],\n",
       " [1, 0, 0, 0, 0, 0],\n",
       " [0, 0, 1, 0, 0, 0],\n",
       " [0, 0, 0, 0, 0, 1],\n",
       " [1, 0, 0, 0, 0, 0],\n",
       " [1, 0, 0, 0, 0, 0],\n",
       " [1, 0, 0, 0, 0, 0],\n",
       " [0, 0, 0, 0, 0, 1],\n",
       " [0, 0, 0, 0, 0, 1],\n",
       " [0, 0, 0, 0, 0, 1],\n",
       " [1, 0, 0, 0, 0, 0],\n",
       " [0, 0, 0, 0, 0, 1],\n",
       " [1, 0, 0, 0, 0, 0],\n",
       " [0, 1, 0, 0, 0, 0],\n",
       " [1, 0, 0, 0, 0, 0],\n",
       " [0, 0, 0, 0, 0, 1],\n",
       " [1, 0, 0, 0, 0, 0],\n",
       " [0, 0, 0, 0, 0, 1],\n",
       " [0, 0, 0, 1, 0, 0],\n",
       " [1, 0, 0, 0, 0, 0],\n",
       " [1, 0, 0, 0, 0, 0],\n",
       " [0, 0, 0, 0, 0, 1],\n",
       " [1, 0, 0, 0, 0, 0],\n",
       " [0, 1, 0, 0, 0, 0],\n",
       " [0, 0, 0, 0, 0, 1],\n",
       " [0, 0, 0, 0, 0, 1],\n",
       " [1, 0, 0, 0, 0, 0],\n",
       " [1, 0, 0, 0, 0, 0],\n",
       " [0, 0, 0, 0, 0, 1],\n",
       " [1, 0, 0, 0, 0, 0],\n",
       " [1, 0, 0, 0, 0, 0],\n",
       " [1, 0, 0, 0, 0, 0],\n",
       " [0, 1, 0, 0, 0, 0],\n",
       " [1, 0, 0, 0, 0, 0],\n",
       " [0, 0, 0, 0, 1, 0],\n",
       " [1, 0, 0, 0, 0, 0],\n",
       " [0, 0, 0, 0, 0, 1],\n",
       " [0, 0, 0, 0, 1, 0],\n",
       " [1, 0, 0, 0, 0, 0],\n",
       " [1, 0, 0, 0, 0, 0],\n",
       " [0, 0, 0, 0, 0, 1],\n",
       " [1, 0, 0, 0, 0, 0],\n",
       " [0, 0, 1, 0, 0, 0],\n",
       " [1, 0, 0, 0, 0, 0],\n",
       " [1, 0, 0, 0, 0, 0],\n",
       " [0, 1, 0, 0, 0, 0],\n",
       " [0, 0, 0, 0, 0, 1],\n",
       " [0, 0, 0, 0, 0, 1],\n",
       " [1, 0, 0, 0, 0, 0],\n",
       " [0, 0, 0, 0, 0, 1],\n",
       " [1, 0, 0, 0, 0, 0],\n",
       " [0, 0, 0, 0, 0, 1],\n",
       " [0, 1, 0, 0, 0, 0],\n",
       " [1, 0, 0, 0, 0, 0],\n",
       " [1, 0, 0, 0, 0, 0],\n",
       " [0, 0, 0, 0, 0, 1],\n",
       " [0, 0, 1, 0, 0, 0],\n",
       " [0, 0, 0, 0, 0, 1],\n",
       " [1, 0, 0, 0, 0, 0],\n",
       " [0, 0, 0, 0, 0, 1],\n",
       " [0, 0, 0, 0, 0, 1],\n",
       " [1, 0, 0, 0, 0, 0],\n",
       " [1, 0, 0, 0, 0, 0],\n",
       " [0, 1, 0, 0, 0, 0],\n",
       " [0, 0, 0, 0, 0, 1],\n",
       " [0, 0, 0, 0, 0, 1],\n",
       " [0, 0, 0, 0, 0, 1],\n",
       " [0, 0, 0, 0, 0, 1],\n",
       " [1, 0, 0, 0, 0, 0],\n",
       " [0, 0, 0, 0, 0, 1],\n",
       " [1, 0, 0, 0, 0, 0],\n",
       " [0, 0, 0, 0, 0, 1],\n",
       " [0, 0, 0, 0, 0, 1],\n",
       " [0, 0, 0, 1, 0, 0],\n",
       " [0, 1, 0, 0, 0, 0],\n",
       " [1, 0, 0, 0, 0, 0],\n",
       " [0, 0, 0, 0, 0, 1],\n",
       " [0, 0, 0, 0, 0, 1],\n",
       " [1, 0, 0, 0, 0, 0],\n",
       " [1, 0, 0, 0, 0, 0],\n",
       " [0, 0, 0, 0, 0, 1],\n",
       " [0, 0, 0, 1, 0, 0],\n",
       " [1, 0, 0, 0, 0, 0],\n",
       " [0, 0, 0, 0, 0, 1],\n",
       " [0, 0, 0, 0, 0, 1],\n",
       " [0, 0, 0, 0, 0, 1],\n",
       " [1, 0, 0, 0, 0, 0],\n",
       " [0, 0, 0, 0, 1, 0],\n",
       " [0, 1, 0, 0, 0, 0],\n",
       " [0, 0, 0, 1, 0, 0],\n",
       " [0, 0, 0, 0, 0, 1],\n",
       " [1, 0, 0, 0, 0, 0],\n",
       " [0, 0, 0, 0, 0, 1],\n",
       " [0, 0, 0, 0, 0, 1],\n",
       " [1, 0, 0, 0, 0, 0],\n",
       " [0, 0, 0, 0, 0, 1],\n",
       " [0, 0, 0, 0, 1, 0],\n",
       " [1, 0, 0, 0, 0, 0],\n",
       " [1, 0, 0, 0, 0, 0],\n",
       " [0, 0, 0, 0, 0, 1],\n",
       " [0, 1, 0, 0, 0, 0],\n",
       " [1, 0, 0, 0, 0, 0],\n",
       " [0, 0, 0, 0, 0, 1],\n",
       " [0, 0, 1, 0, 0, 0],\n",
       " [0, 0, 0, 1, 0, 0],\n",
       " [0, 0, 1, 0, 0, 0],\n",
       " [0, 0, 0, 1, 0, 0],\n",
       " [0, 0, 0, 0, 1, 0],\n",
       " [1, 0, 0, 0, 0, 0],\n",
       " [0, 0, 0, 0, 0, 1],\n",
       " [0, 1, 0, 0, 0, 0],\n",
       " [0, 0, 0, 0, 0, 1],\n",
       " [0, 0, 0, 0, 0, 1],\n",
       " [0, 0, 0, 0, 0, 1],\n",
       " [0, 0, 0, 1, 0, 0],\n",
       " [0, 0, 0, 0, 0, 1],\n",
       " [0, 0, 0, 0, 0, 1],\n",
       " [0, 0, 0, 0, 1, 0],\n",
       " [1, 0, 0, 0, 0, 0],\n",
       " [1, 0, 0, 0, 0, 0],\n",
       " [1, 0, 0, 0, 0, 0],\n",
       " [0, 0, 0, 0, 0, 1],\n",
       " [0, 0, 0, 0, 0, 1],\n",
       " [0, 0, 0, 0, 0, 1],\n",
       " [0, 0, 0, 0, 0, 1],\n",
       " [1, 0, 0, 0, 0, 0],\n",
       " [1, 0, 0, 0, 0, 0],\n",
       " [0, 0, 0, 0, 0, 1],\n",
       " [1, 0, 0, 0, 0, 0],\n",
       " [0, 0, 1, 0, 0, 0],\n",
       " [0, 0, 0, 1, 0, 0],\n",
       " [1, 0, 0, 0, 0, 0],\n",
       " [0, 0, 1, 0, 0, 0],\n",
       " [0, 0, 0, 0, 0, 1],\n",
       " [0, 0, 0, 0, 0, 1],\n",
       " [1, 0, 0, 0, 0, 0],\n",
       " [0, 0, 1, 0, 0, 0],\n",
       " [0, 0, 0, 0, 0, 1],\n",
       " [0, 0, 0, 1, 0, 0],\n",
       " [1, 0, 0, 0, 0, 0],\n",
       " [0, 0, 0, 1, 0, 0],\n",
       " [0, 1, 0, 0, 0, 0],\n",
       " [0, 0, 0, 1, 0, 0],\n",
       " [1, 0, 0, 0, 0, 0],\n",
       " [1, 0, 0, 0, 0, 0],\n",
       " [1, 0, 0, 0, 0, 0],\n",
       " [0, 1, 0, 0, 0, 0],\n",
       " [0, 0, 0, 0, 0, 1],\n",
       " [1, 0, 0, 0, 0, 0],\n",
       " [1, 0, 0, 0, 0, 0],\n",
       " [0, 0, 0, 0, 0, 1],\n",
       " [1, 0, 0, 0, 0, 0],\n",
       " [1, 0, 0, 0, 0, 0],\n",
       " [1, 0, 0, 0, 0, 0],\n",
       " [0, 0, 0, 0, 0, 1],\n",
       " [0, 1, 0, 0, 0, 0],\n",
       " [0, 0, 0, 0, 0, 1],\n",
       " [0, 0, 0, 0, 0, 1],\n",
       " [0, 0, 0, 0, 0, 1],\n",
       " [0, 0, 0, 0, 0, 1],\n",
       " [0, 1, 0, 0, 0, 0],\n",
       " [0, 0, 0, 0, 0, 1],\n",
       " [1, 0, 0, 0, 0, 0],\n",
       " [1, 0, 0, 0, 0, 0],\n",
       " [0, 0, 0, 0, 0, 1],\n",
       " [0, 0, 0, 0, 0, 1],\n",
       " [1, 0, 0, 0, 0, 0],\n",
       " [1, 0, 0, 0, 0, 0],\n",
       " [1, 0, 0, 0, 0, 0],\n",
       " [1, 0, 0, 0, 0, 0],\n",
       " [0, 0, 0, 1, 0, 0],\n",
       " [0, 0, 0, 0, 0, 1],\n",
       " [0, 0, 0, 0, 0, 1],\n",
       " [1, 0, 0, 0, 0, 0],\n",
       " [0, 1, 0, 0, 0, 0],\n",
       " [0, 0, 0, 0, 0, 1],\n",
       " [0, 0, 0, 1, 0, 0],\n",
       " [1, 0, 0, 0, 0, 0],\n",
       " [0, 0, 0, 0, 0, 1],\n",
       " [1, 0, 0, 0, 0, 0],\n",
       " [1, 0, 0, 0, 0, 0],\n",
       " [0, 0, 0, 0, 0, 1],\n",
       " [1, 0, 0, 0, 0, 0],\n",
       " [0, 0, 0, 0, 0, 1],\n",
       " [0, 0, 0, 1, 0, 0],\n",
       " [0, 0, 0, 1, 0, 0],\n",
       " [1, 0, 0, 0, 0, 0],\n",
       " [0, 0, 1, 0, 0, 0],\n",
       " [1, 0, 0, 0, 0, 0],\n",
       " [0, 0, 1, 0, 0, 0],\n",
       " [1, 0, 0, 0, 0, 0],\n",
       " [1, 0, 0, 0, 0, 0],\n",
       " [1, 0, 0, 0, 0, 0],\n",
       " [0, 0, 0, 0, 0, 1],\n",
       " [0, 0, 0, 1, 0, 0],\n",
       " [0, 0, 0, 0, 1, 0],\n",
       " [0, 1, 0, 0, 0, 0],\n",
       " [0, 0, 0, 0, 1, 0],\n",
       " [0, 0, 0, 0, 0, 1],\n",
       " [0, 0, 0, 0, 0, 1],\n",
       " [0, 0, 1, 0, 0, 0],\n",
       " [0, 0, 0, 0, 0, 1],\n",
       " [0, 0, 0, 0, 0, 1],\n",
       " [0, 1, 0, 0, 0, 0],\n",
       " [0, 1, 0, 0, 0, 0],\n",
       " [1, 0, 0, 0, 0, 0],\n",
       " [0, 0, 0, 0, 1, 0],\n",
       " [0, 0, 0, 1, 0, 0],\n",
       " [0, 0, 0, 0, 1, 0],\n",
       " [0, 0, 0, 1, 0, 0],\n",
       " [0, 0, 0, 0, 1, 0],\n",
       " [0, 0, 0, 0, 0, 1],\n",
       " [1, 0, 0, 0, 0, 0],\n",
       " [0, 1, 0, 0, 0, 0],\n",
       " [0, 0, 0, 0, 1, 0],\n",
       " [0, 0, 0, 0, 1, 0],\n",
       " [0, 0, 0, 0, 0, 1],\n",
       " [0, 0, 0, 0, 0, 1],\n",
       " [0, 0, 0, 1, 0, 0],\n",
       " [0, 0, 0, 0, 0, 1],\n",
       " [0, 0, 0, 0, 0, 1],\n",
       " [1, 0, 0, 0, 0, 0],\n",
       " [1, 0, 0, 0, 0, 0],\n",
       " [0, 0, 0, 1, 0, 0],\n",
       " [1, 0, 0, 0, 0, 0],\n",
       " [0, 0, 0, 0, 0, 1],\n",
       " [1, 0, 0, 0, 0, 0],\n",
       " [0, 0, 1, 0, 0, 0],\n",
       " [1, 0, 0, 0, 0, 0],\n",
       " [0, 0, 0, 1, 0, 0],\n",
       " [1, 0, 0, 0, 0, 0],\n",
       " [0, 1, 0, 0, 0, 0],\n",
       " [0, 1, 0, 0, 0, 0],\n",
       " [0, 1, 0, 0, 0, 0],\n",
       " [1, 0, 0, 0, 0, 0],\n",
       " [0, 0, 0, 0, 1, 0],\n",
       " [0, 0, 1, 0, 0, 0],\n",
       " [0, 0, 0, 0, 1, 0],\n",
       " [0, 0, 0, 0, 0, 1],\n",
       " [1, 0, 0, 0, 0, 0],\n",
       " [1, 0, 0, 0, 0, 0],\n",
       " [1, 0, 0, 0, 0, 0],\n",
       " [1, 0, 0, 0, 0, 0],\n",
       " [1, 0, 0, 0, 0, 0],\n",
       " [0, 0, 0, 0, 0, 1],\n",
       " [0, 0, 0, 0, 0, 1],\n",
       " [0, 1, 0, 0, 0, 0],\n",
       " [0, 1, 0, 0, 0, 0],\n",
       " [1, 0, 0, 0, 0, 0],\n",
       " [0, 1, 0, 0, 0, 0],\n",
       " [1, 0, 0, 0, 0, 0],\n",
       " [1, 0, 0, 0, 0, 0],\n",
       " [1, 0, 0, 0, 0, 0],\n",
       " [0, 0, 0, 0, 0, 1],\n",
       " [0, 0, 0, 1, 0, 0],\n",
       " [0, 0, 0, 1, 0, 0],\n",
       " [1, 0, 0, 0, 0, 0],\n",
       " [0, 0, 0, 0, 1, 0],\n",
       " [1, 0, 0, 0, 0, 0],\n",
       " [0, 0, 0, 1, 0, 0],\n",
       " [0, 0, 0, 1, 0, 0],\n",
       " [0, 0, 0, 0, 0, 1],\n",
       " [0, 0, 0, 0, 0, 1],\n",
       " [0, 0, 0, 0, 0, 1],\n",
       " [1, 0, 0, 0, 0, 0],\n",
       " [0, 1, 0, 0, 0, 0],\n",
       " [0, 0, 0, 0, 0, 1],\n",
       " [1, 0, 0, 0, 0, 0],\n",
       " [0, 0, 1, 0, 0, 0],\n",
       " [1, 0, 0, 0, 0, 0],\n",
       " [1, 0, 0, 0, 0, 0],\n",
       " [0, 0, 0, 0, 0, 1],\n",
       " [0, 0, 0, 0, 0, 1],\n",
       " [0, 0, 0, 1, 0, 0],\n",
       " [0, 0, 0, 0, 0, 1],\n",
       " [0, 0, 0, 0, 0, 1],\n",
       " [1, 0, 0, 0, 0, 0],\n",
       " [1, 0, 0, 0, 0, 0],\n",
       " [1, 0, 0, 0, 0, 0],\n",
       " [1, 0, 0, 0, 0, 0],\n",
       " [1, 0, 0, 0, 0, 0],\n",
       " [1, 0, 0, 0, 0, 0],\n",
       " [1, 0, 0, 0, 0, 0],\n",
       " [0, 1, 0, 0, 0, 0],\n",
       " [0, 0, 0, 0, 0, 1],\n",
       " [0, 1, 0, 0, 0, 0],\n",
       " [0, 0, 0, 0, 0, 1],\n",
       " [1, 0, 0, 0, 0, 0],\n",
       " [1, 0, 0, 0, 0, 0],\n",
       " [0, 1, 0, 0, 0, 0],\n",
       " [0, 0, 0, 0, 0, 1],\n",
       " [1, 0, 0, 0, 0, 0],\n",
       " [0, 0, 0, 1, 0, 0],\n",
       " [0, 0, 0, 0, 0, 1],\n",
       " [1, 0, 0, 0, 0, 0],\n",
       " [0, 0, 1, 0, 0, 0],\n",
       " [0, 0, 0, 0, 0, 1],\n",
       " [0, 0, 0, 0, 1, 0],\n",
       " [1, 0, 0, 0, 0, 0],\n",
       " [0, 0, 1, 0, 0, 0],\n",
       " [0, 0, 0, 0, 0, 1],\n",
       " [1, 0, 0, 0, 0, 0],\n",
       " [0, 0, 0, 1, 0, 0],\n",
       " [0, 0, 0, 0, 0, 1],\n",
       " [1, 0, 0, 0, 0, 0],\n",
       " [1, 0, 0, 0, 0, 0],\n",
       " [1, 0, 0, 0, 0, 0],\n",
       " [0, 0, 0, 0, 0, 1],\n",
       " [0, 0, 0, 1, 0, 0],\n",
       " [1, 0, 0, 0, 0, 0],\n",
       " [0, 0, 0, 0, 0, 1],\n",
       " [0, 0, 0, 0, 0, 1],\n",
       " [1, 0, 0, 0, 0, 0],\n",
       " [0, 0, 0, 0, 0, 1],\n",
       " [1, 0, 0, 0, 0, 0],\n",
       " [1, 0, 0, 0, 0, 0],\n",
       " [0, 0, 0, 0, 0, 1],\n",
       " [0, 0, 0, 0, 0, 1],\n",
       " [0, 0, 0, 0, 0, 1],\n",
       " [0, 0, 0, 0, 0, 1],\n",
       " [0, 0, 0, 0, 0, 1],\n",
       " [1, 0, 0, 0, 0, 0],\n",
       " [1, 0, 0, 0, 0, 0],\n",
       " [0, 0, 0, 0, 1, 0],\n",
       " [1, 0, 0, 0, 0, 0],\n",
       " [1, 0, 0, 0, 0, 0],\n",
       " [0, 0, 0, 0, 0, 1],\n",
       " [0, 0, 0, 0, 0, 1],\n",
       " [1, 0, 0, 0, 0, 0],\n",
       " [0, 0, 0, 0, 0, 1],\n",
       " [0, 0, 0, 0, 0, 1],\n",
       " [0, 0, 0, 0, 0, 1],\n",
       " [1, 0, 0, 0, 0, 0],\n",
       " [1, 0, 0, 0, 0, 0],\n",
       " [1, 0, 0, 0, 0, 0],\n",
       " [0, 0, 0, 1, 0, 0],\n",
       " [1, 0, 0, 0, 0, 0],\n",
       " [1, 0, 0, 0, 0, 0],\n",
       " [0, 0, 0, 0, 0, 1],\n",
       " [0, 0, 0, 0, 0, 1],\n",
       " [0, 0, 0, 0, 0, 1],\n",
       " [0, 0, 0, 0, 0, 1],\n",
       " [0, 1, 0, 0, 0, 0],\n",
       " [0, 0, 0, 0, 0, 1],\n",
       " [0, 0, 0, 0, 0, 1],\n",
       " [0, 0, 0, 0, 1, 0],\n",
       " [1, 0, 0, 0, 0, 0],\n",
       " [0, 1, 0, 0, 0, 0],\n",
       " [0, 0, 1, 0, 0, 0],\n",
       " [1, 0, 0, 0, 0, 0],\n",
       " [0, 0, 1, 0, 0, 0],\n",
       " [0, 1, 0, 0, 0, 0],\n",
       " [0, 0, 0, 0, 1, 0],\n",
       " [0, 1, 0, 0, 0, 0],\n",
       " [0, 0, 1, 0, 0, 0],\n",
       " [0, 0, 0, 0, 0, 1],\n",
       " [1, 0, 0, 0, 0, 0],\n",
       " [0, 0, 0, 0, 1, 0],\n",
       " [0, 1, 0, 0, 0, 0],\n",
       " [0, 0, 0, 0, 0, 1],\n",
       " [1, 0, 0, 0, 0, 0],\n",
       " [0, 0, 0, 0, 1, 0],\n",
       " [0, 0, 0, 1, 0, 0],\n",
       " [0, 0, 0, 1, 0, 0],\n",
       " [0, 0, 0, 0, 0, 1],\n",
       " [1, 0, 0, 0, 0, 0],\n",
       " [1, 0, 0, 0, 0, 0],\n",
       " [0, 1, 0, 0, 0, 0],\n",
       " [0, 0, 0, 0, 1, 0],\n",
       " [0, 0, 1, 0, 0, 0],\n",
       " [0, 0, 1, 0, 0, 0],\n",
       " [1, 0, 0, 0, 0, 0],\n",
       " [1, 0, 0, 0, 0, 0],\n",
       " [0, 0, 0, 1, 0, 0],\n",
       " [1, 0, 0, 0, 0, 0],\n",
       " [1, 0, 0, 0, 0, 0],\n",
       " [0, 0, 0, 0, 0, 1],\n",
       " [1, 0, 0, 0, 0, 0],\n",
       " [1, 0, 0, 0, 0, 0],\n",
       " [0, 0, 0, 0, 0, 1],\n",
       " [1, 0, 0, 0, 0, 0],\n",
       " [1, 0, 0, 0, 0, 0],\n",
       " [0, 0, 0, 0, 0, 1],\n",
       " [0, 0, 0, 0, 0, 1],\n",
       " [1, 0, 0, 0, 0, 0],\n",
       " [1, 0, 0, 0, 0, 0],\n",
       " [0, 0, 0, 0, 0, 1],\n",
       " [0, 1, 0, 0, 0, 0],\n",
       " [1, 0, 0, 0, 0, 0],\n",
       " [1, 0, 0, 0, 0, 0],\n",
       " [1, 0, 0, 0, 0, 0],\n",
       " [1, 0, 0, 0, 0, 0],\n",
       " [1, 0, 0, 0, 0, 0],\n",
       " [0, 0, 0, 0, 0, 1],\n",
       " [1, 0, 0, 0, 0, 0],\n",
       " [0, 0, 0, 0, 0, 1],\n",
       " [1, 0, 0, 0, 0, 0],\n",
       " [1, 0, 0, 0, 0, 0],\n",
       " [0, 1, 0, 0, 0, 0],\n",
       " [1, 0, 0, 0, 0, 0],\n",
       " [1, 0, 0, 0, 0, 0],\n",
       " [1, 0, 0, 0, 0, 0],\n",
       " [0, 0, 0, 0, 0, 1],\n",
       " [0, 0, 0, 0, 0, 1],\n",
       " [1, 0, 0, 0, 0, 0],\n",
       " [1, 0, 0, 0, 0, 0],\n",
       " [0, 0, 0, 0, 0, 1],\n",
       " [1, 0, 0, 0, 0, 0],\n",
       " [0, 0, 0, 0, 0, 1],\n",
       " [0, 0, 1, 0, 0, 0],\n",
       " [0, 0, 0, 0, 0, 1]]"
      ]
     },
     "execution_count": 24,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "result"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 25,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "              precision    recall  f1-score   support\n",
      "\n",
      "           0     0.8502    0.8470    0.8486       268\n",
      "           1     0.7586    0.6471    0.6984        68\n",
      "           2     0.4762    0.6061    0.5333        33\n",
      "           3     0.6000    0.6000    0.6000        50\n",
      "           4     0.8919    0.6600    0.7586        50\n",
      "           5     0.7650    0.8174    0.7903       219\n",
      "\n",
      "   micro avg     0.7747    0.7747    0.7747       688\n",
      "   macro avg     0.7236    0.6962    0.7049       688\n",
      "weighted avg     0.7809    0.7747    0.7755       688\n",
      " samples avg     0.7747    0.7747    0.7747       688\n",
      "\n"
     ]
    }
   ],
   "source": [
    "from sklearn.metrics import classification_report\n",
    "print(classification_report(labels_t,result,digits = 4))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 26,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "3"
      ]
     },
     "execution_count": 26,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "list(labels_t[0]).index(1)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 27,
   "metadata": {},
   "outputs": [],
   "source": [
    "labels_t_list = []\n",
    "for i in labels_t:\n",
    "    res = list(i).index(1)\n",
    "    labels_t_list.append(res)\n",
    "    "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 28,
   "metadata": {},
   "outputs": [],
   "source": [
    "result_list = []\n",
    "for i in result:\n",
    "    res = list(i).index(1)\n",
    "    result_list.append(res)\n",
    "    "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 29,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "              precision    recall  f1-score   support\n",
      "\n",
      "           0     0.8502    0.8470    0.8486       268\n",
      "           1     0.7586    0.6471    0.6984        68\n",
      "           2     0.4762    0.6061    0.5333        33\n",
      "           3     0.6000    0.6000    0.6000        50\n",
      "           4     0.8919    0.6600    0.7586        50\n",
      "           5     0.7650    0.8174    0.7903       219\n",
      "\n",
      "    accuracy                         0.7747       688\n",
      "   macro avg     0.7236    0.6962    0.7049       688\n",
      "weighted avg     0.7809    0.7747    0.7755       688\n",
      "\n"
     ]
    }
   ],
   "source": [
    "print(classification_report(labels_t_list,result_list,digits = 4))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "colab": {
   "default_view": {},
   "name": "RNN.ipynb",
   "provenance": [],
   "version": "0.3.2",
   "views": {}
  },
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.8.5"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 1
}
